"""
使用函数统计指定数字的个数
"""
def CountDigit(number, digit):
    count = 0
    if number < 0:
        number = -number
    while number != 0:
        num = number % 10
        number //=10
        if num == digit:
            count += 1
    return count


number,digit=input().split()
number=int(number)
digit=int(digit)
count=CountDigit(number,digit )
print("Number of digit 2 in "+str(number)+":",count)